package com.masterclient.app.businessmodule.minemodule.redpack.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.masterclient.app.R;
import com.masterclient.app.modules.coupon.beans.RedPackedDetailsBean;
import com.eoner.baselibrary.utils.ScreenUtils;
import com.eoner.baselibrary.utils.Utils;
import com.eoner.baselibrary.utils.ViewTransformUtil;

import jp.wasabeef.glide.transformations.RoundedCornersTransformation;

/**
 * @auther hjian
 * @date 2020/1/2.
 */
public class RedPackedGoodsChildAdapter extends BaseQuickAdapter<RedPackedDetailsBean.ShTaskProductBean, BaseViewHolder> {
    public RedPackedGoodsChildAdapter() {
        super(R.layout.item_order_good_child);
    }

    @Override
    protected void convert(BaseViewHolder helper, RedPackedDetailsBean.ShTaskProductBean item) {
        ViewTransformUtil.glideImageView(mContext,item.getSh_image(),(ImageView) helper.getView(R.id.item_ordergoods_img),
                new RoundedCornersTransformation(ScreenUtils.dp2px(4), 0),
                R.mipmap.defaults,ScreenUtils.dp2px(107), ScreenUtils.dp2px(107));
        helper.setText(R.id.item_ordergoods_title, item.getSh_name())
                .setText(R.id.item_ordergoods_price,item.getSh_price())
                .setText(R.id.item_ordergoods_num, "x"+item.getSh_num())
                .setGone(R.id.item_ordergoods_line, helper.getAdapterPosition() != getData().size()-1);
        Utils.setDin(helper.getView(R.id.item_ordergoods_price),mContext);
        Utils.setDin(helper.getView(R.id.item_ordergoods_unit),mContext);
    }
}
